#!/usr/bin/env python
import freenect
import time
import random
import signal
import sys

keep_running = True
last_time = 0
deg = int(sys.argv[1])

def body(dev, ctx):
    global deg
    freenect.set_tilt_degs(dev, deg)
    print('tilt[%d] accel[%s]' % (tilt, freenect.get_accel(dev)))


def handler(signum, frame):
    """Sets up the kill handler, catches SIGINT"""
    global keep_running
    keep_running = False
print('Press Ctrl-C in terminal to stop')
signal.signal(signal.SIGINT, handler)
freenect.runloop(body=body)


